<script setup>
  const props = defineProps({
    money: Number,
    car: String
  })
  console.log(props.car)
  // 利用defineEmits声明函数
  const emit = defineEmits(['changeMoney', 'changeCar'])
  const pay = () => {
    emit('changeMoney', 10)
  }
  const changeCar =() => {
    emit('changeCar', '玛莎拉蒂')
  }
</script>

<template>
  <div class="child-page">
    我是子组件: 
    <div>{{ money }}------ {{ car }}</div>
    <button @click="pay">花钱了</button>
    <button @click="changeCar">换车</button>
  </div>
</template>

<style scoped></style>
